package com.example.mz.dynamicdb.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.mz.dynamicdb.entity.School;
import com.example.mz.dynamicdb.mapper.SchoolMapper;
import com.example.mz.dynamicdb.service.SchoolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@DS("DB3307")
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public class SchoolServiceIml implements SchoolService {

    @Autowired
    public SchoolMapper schoolMapper;
    @Override
    public List<School> getSchoolList() {
        return schoolMapper.getSchoolList();
    }

    @Override
    public void addSchool(School school) {
        schoolMapper.addSchool(school);
    }
}
